package com.best.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.best.weiyi.R;
import com.best.weiyi.entity.Song;

public class SearchMusicIdListAdapter extends BaseAdapter{
	private Context mContext;
	private List<Song> list;
	public SearchMusicIdListAdapter(Context mContext,List<Song> list){
		this.mContext = mContext;
		this.list = list;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ViewHolder vh = null;
		if(arg1 == null){
			vh = new ViewHolder();
			arg1 = LayoutInflater.from(mContext).inflate(R.layout.search_musiclist_item, null);
			vh.showName = (TextView) arg1.findViewById(R.id.list_name);
			vh.showSinger = (TextView) arg1.findViewById(R.id.list_singer);
			
		}else{
			arg1.setTag(vh);
		}
		if("".equals(list.get(0).getSong_id())){
			vh.showName.setText("暂无歌曲名称信息");
		}else{
			vh.showName.setText(list.get(0).getSong().toString());
		}
		
		
		return arg1;
	}
	public class ViewHolder{
		TextView showName,showSinger;
	}
	
}
